/* priority queue implemented based on min-heap */
#ifndef PRIORITY_QUEUE
#define PRIORITY_QUEUE

typedef int comparison_func(const void *item1, const void *item2);

struct Priority_Queue {
	comparison_func *compare;
	int count; /* current number */
	int size; /* total size */
	void **items;
};

struct Priority_Queue *create(int size, comparison_func *comp);
void *pop(struct Priority_Queue *);
void push(struct Priority_Queue *, void *);
void *top(struct Priority_Queue *);
void destroy(struct Priority_Queue *);
#define Size(priority_queue) ((priority_queue)->size)
#define Count(priority_queue) ((priority_queue)->count)

#endif
